package com.graduation.check.mapper;

import com.graduation.check.entity.TitleDuplicateResult;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TitleDuplicateResultMapper {

    @Insert("INSERT INTO title_duplicate_result (check_task_id, similar_title, similarity, author, class_name, year, paper_id) " +
            "VALUES (#{checkTaskId}, #{similarTitle}, #{similarity}, #{author}, #{className}, #{year}, #{paperId})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(TitleDuplicateResult result);

    @Select("SELECT * FROM title_duplicate_result WHERE check_task_id = #{checkTaskId}")
    List<TitleDuplicateResult> findByCheckTaskId(Long checkTaskId);

    @Delete("DELETE FROM title_duplicate_result WHERE check_task_id = #{checkTaskId}")
    void deleteByCheckTaskId(Long checkTaskId);
}